:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --border-color: #e9ecef;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.container-header {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--card-background) 0%, var(--background-color) 100%);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.container-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.75rem;
}

.part-container {
    background: var(--card-background);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.part-container:hover {
    box-shadow: var(--shadow-lg);
}

.selector {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.selector label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    min-width: 80px;
}

.selector select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    background-color: var(--card-background);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.selector select:hover, .selector select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
    outline: none;
}

.toggle-button {
    display: inline-flex;
    background: var(--border-color);
    border-radius: 0.35rem;
    padding: 0.15rem;
    margin: 0;
    border: none;
}

.toggle-item {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.toggle-item.active {
    background: var(--secondary-color);
    color: white;
}

.summary-table {
    margin-bottom: 1rem;
    overflow-x: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-background);
}

th, td {
    padding: 0.75rem;
    text-align: center;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    background-color: rgba(44, 62, 80, 0.05);
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.85rem;
}

tr:last-child td {
    border-bottom: none;
}

.part-chart-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    margin-top: 1rem;
}

.data-container, .chart-container {
    background: var(--card-background);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.data-container > div {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.data-container > div:last-child {
    border-bottom: none;
}

.data-container > div > .level-tag {
    flex: 0 0 50px;
    text-align: center;
}

.data-container > div > .level-tag + div {
    flex: 1;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.name-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.35rem;
    border-radius: 0.2rem;
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
    font-size: 0.75rem;
    white-space: nowrap;
}

.level-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 28px;
    padding: 0;
    border-radius: 0.25rem;
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
    font-size: 0.875rem;
    text-align: center;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.rank-tag {
    display: inline-block;
    width: auto;
    min-width: 2rem;
    margin-right: 0.5rem;
    font-weight: 500;
}

.arrow-up {
    color: var(--success-color);
}

.arrow-down {
    color: var(--accent-color);
}

.exam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.exam-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.content {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 1.5rem;
}

.table-container {
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container th,
.table-container td {
    padding: 0.5rem;
    text-align: left;
    white-space: nowrap;
}

#chart-container {
    height: 330px;
    padding: 0.75rem;
}

#rankingChart {
    max-height: 100%;
    width: 100% !important;
}

.sheet-tabs {
    margin: 20px 0;
    border-bottom: 1px solid #dee2e6;
}

.sheet-tabs .nav-link {
    color: #495057;
    border: 1px solid transparent;
    border-top-left-radius: .25rem;
    border-top-right-radius: .25rem;
    padding: .5rem 1rem;
    margin-bottom: -1px;
    cursor: pointer;
}

.sheet-tabs .nav-link.active {
    color: #0d6efd;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

.sheet-tabs .nav-link:hover:not(.active) {
    border-color: #e9ecef #e9ecef #dee2e6;
}

/* Toast 提示样式 */
.toast {
    min-width: 300px;
    max-width: 400px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    margin-bottom: 1rem;
}

.toast .toast-header {
    padding: 0.75rem 1rem;
    border-bottom: none;
}

.toast .toast-header strong {
    font-size: 0.95rem;
}

.toast .toast-body {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
}

.toast .toast-body ul {
    margin-top: 0.5rem;
}

.toast .toast-body li {
    margin-bottom: 0.25rem;
    color: #666;
}

.toast .toast-body li:last-child {
    margin-bottom: 0;
}

@media (max-width: 992px) {
    .part-chart-wrapper {
        grid-template-columns: 1fr;
    }

    .content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .part-container {
        padding: 1rem;
    }

    .selector {
        flex-direction: column;
        align-items: stretch;
    }

    .selector label {
        margin-bottom: 0.5rem;
    }

    th, td {
        padding: 0.75rem;
    }
}